import request from '@/util/request'
export function addlicence ({ carNo, carImg }) {
  return request({
    url: '/api/front/designer/park/ticket',
    method: 'post',
    data: { car_no: carNo, car_img: carImg }
  })
}
export function getlicence () {
  return request({
    url: '/api/front/designer/ticket',
    method: 'get'
  })
}
export function addWorks ({ cover, content, title, images }) {
  return request({
    url: '/api/front/designer/case',
    method: 'post',
    data: { cover, content, title, images }
  })
}
export function editWorks ({ id, cover, content, title, images }) {
  return request({
    url: '/api/front/designer/case/update',
    method: 'post',
    data: { id, cover, content, title, images }
  })
};
export function upload (photo) {
  return request({
    url: '/api/common/upload',
    method: 'post',
    data: photo
  })
}
export function delCaseItem (id) {
  return request({
    url: '/api/front/designer/case/del',
    method: 'post',
    data: { id }
  })
}
export function designerInfoEdit ({ name, rate, styles, avatar, workAge, companyName, form, companyTel, phone, captcha }) {
  return request({
    url: '/api/front/designer/modify',
    method: 'post',
    data: { name, rate, styles, avatar, work_age: workAge, company_name: companyName, form, company_tel: companyTel, phone, captcha }
  })
}
// 擅长风格 年龄
export function getStaticsConfig () {
  return request({
    url: '/api/front/designer/config',
    method: 'get'
  })
}
export function getCaptcha (phone) {
  return request({
    url: '/api/common/captcha',
    method: 'post',
    data: { phone }
  })
}
export function getMyActivity (status) {
  return request({
    url: '/api/front/designer/activity',
    method: 'get',
    params: { status }
  })
}
export function getMyCustomList () {
  return request({
    url: '/api/front/designer/customers',
    method: 'get'
  })
}
export function addCustomItem ({ phone, name, shops, brands }) {
  return request({
    url: '/api/front/designer/customer',
    method: 'post',
    data: { phone, name, shops, brands }
  })
}
export function getCustomDetail (id) {
  return request({
    url: `/api/front/designer/customers/${id}`,
    method: 'get'
  })
}
export function editCustomBrand ({ id, shops }) {
  return request({
    url: '/api/front/designer/customers/modify',
    method: 'post',
    data: { id, shops }
  })
}
export function getCustomOrderList ({ status, page }) {
  return request({
    url: '/api/front/designer/customers/order',
    method: 'get',
    params: { status, page }
  })
}
export function getConselorList () {
  return request({
    url: '/api/front/designer/counselor',
    method: 'get'
  })
}
export function getDesignerInfo (informationId) {
  return request({
    url: '/api/front/index/designer',
    method: 'get',
    params: { information_id: informationId }
  })
}
export function getCouponList (type, informationId) {
  return request({
    url: '/api/front/designer/coupon',
    method: 'get',
    params: { type, information_id: informationId }
  })
}
export function getUserCouponList (type, informationId) {
  return request({
    url: '/api/front/user/coupon',
    method: 'get',
    params: { type, information_id: informationId }
  })
};
// 优惠券详情
export function getCouponDetail (id, designerId) {
  return request({
    url: '/api/front/index/coupons',
    method: 'get',
    params: { id, designer_id: designerId }
  })
}
export function getIntegralGoodsList (page) {
  return request({
    url: '/api/front/goods',
    method: 'get',
    params: { page }
  })
}
export function getRecordIntegralGoodsList (page) {
  return request({
    url: '/api/front/goods/order',
    method: 'get',
    params: { page }
  })
}
export function integralGoodsDetail (id) {
  return request({
    url: `/api/front/goods/${id}`,
    method: 'get'
  })
}
export function integralGoodsExchange ({ goodsId, deliveryType, addressId }) {
  return request({
    url: '/api/front/goods/order',
    method: 'post',
    data: { goods_id: goodsId, delivery_type: deliveryType, address_id: addressId }
  })
}
export function getAddressList () {
  return request({
    url: '/api/front/designer/address',
    method: 'get'
  })
}
export function addAddressItem ({ receiverName, receiverPhone, receiverEmail, address, province, city, area }) {
  return request({
    url: '/api/front/designer/address',
    method: 'post',
    data: { receiver_name: receiverName, receiver_phone: receiverPhone, receiver_email: receiverEmail, address, province, city, area, is_default: 0 }
  })
}
export function editAddressItem ({ receiverName, receiverPhone, receiverEmail, address, province, city, area, id }) {
  return request({
    url: `/api/front/designer/address/${id}`,
    method: 'post',
    data: { receiver_name: receiverName, receiver_phone: receiverPhone, receiver_email: receiverEmail, address, province, city, area, is_default: 0 }
  })
}
export function deleteAddressItem (id) {
  return request({
    url: `/api/front/designer/address/${id}`,
    method: 'DELETE'
  })
};
export function setDefaultAddr (id) {
  return request({
    url: `/api/front/designer/address/${id}`,
    method: 'post',
    data: { is_default: 1 }
  })
}
export function getOrderGoodsDetail (id, informationId) {
  return request({
    url: `/api/front/goods/order/${id}/detail`,
    method: 'get',
    params: { information_id: informationId }
  })
}
export function getMyTask () {
  return request({
    url: '/api/front/index/task',
    method: 'get'
  })
}
export function codeVerification (id, verifyCode) {
  return request({
    url: '/api/front/user/coupon/verify',
    method: 'post',
    data: { id, verify_code: verifyCode }
  })
}
// 扫码核销
export function getQrCodetext (userCouponId) {
  return request({
    url: 'api/front/index/coupon/verifyByCode',
    method: 'get',
    params: { user_coupon_id: userCouponId }
  })
};
export function setUserInfo ({ portraitUrl, nickname }) {
  return request({
    url: '/api/front/user/modify',
    method: 'post',
    data: { portrait_url: portraitUrl, nickname }
  })
}
export function getReservationList () {
  return request({
    url: '/api/front/user/appointment',
    method: 'get'
  })
}
export function getSearchActivityList (keywords, page) {
  return request({
    url: '/api/front/activity',
    method: 'get',
    params: { keywords, page }
  })
}
export function getSearchDesignerList (keywords, page) {
  return request({
    url: '/api/front/designer',
    method: 'get',
    params: { keywords, page }
  })
}
export function getSearchBrandList (keywords, page) {
  return request({
    url: '/api/front/brand',
    method: 'get',
    params: { keywords, page }
  })
}
export function getDesignerSearchFiltrate ({ rate, form, style }) {
  return request({
    url: '/api/front/designer',
    method: 'get',
    params: { rate, form, style }
  })
}
export function getCouponItem (id) {
  return request({
    url: '/api/front/user/coupon',
    method: 'post',
    data: { id }
  })
}
export function getMessageList (type, page) {
  return request({
    url: '/api/front/user/information',
    method: 'get',
    params: { type, page }
  })
}
export function getUserInfo () {
  return request({
    url: '/api/front/user',
    method: 'get'
  })
}
export function punchCard (taskId) {
  return request({
    url: '/api/front/index/sign',
    method: 'get',
    params: { task_id: taskId }
  })
}
export function getGoodsExpress (expressNo) {
  return request({
    url: '/api/common/express',
    method: 'get',
    params: { express_no: expressNo }
  })
}
export function getIntegralDetail () {
  return request({
    url: '/api/front/designer/score',
    method: 'get'
  })
};
// 获取二维码
export function getMiniCode () {
  return request({
    url: '/api/front/user/share',
    method: 'get'
  })
}
export function getCodeText () {
  return request({
    url: '/api/front/user/official/show',
    method: 'get'
  })
};
export function getMsgDetail (id) {
  return request({
    url: `/api/front/user/information/${id}`,
    method: 'get'
  })
}
export function sendCode (code) {
  return request({
    url: '/api/front/user/get/openid',
    method: 'get',
    params: { code }
  })
}
export function getJSSDKParams (url) {
  return request({
    url: '/api/front/index/jssdk',
    method: 'get',
    params: { url }
  })
};
